import { Controller, Get, Post, Body, Patch, Param, Delete,Query,Req,Headers } from '@nestjs/common';
import { AuthService } from './auth.service';
@Controller('system/auth')
export class AuthController {
  constructor(private readonly authService: AuthService) {
    
  }
  @Post('token')
  async token(@Body() body: any) {
    console.log(body)
    let {username,password} = body;
    return this.authService.token(username,password);
  }

  @Get('userInfo')
  async userInfo(@Headers() headers: any) {
    let token = headers['authorization'];
    return this.authService.userInfo(token);
  }

  @Get('userMenu')
  async userMenu(@Headers() headers: any,@Query() query:any) {
    let token = headers['authorization'];
    let {name}  = query;
    return this.authService.userMenu(token,name);
  }



}